<%--
功能：输出商品目录URL
--%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<%@ tag import="org.springframework.context.ApplicationContext" %>
<%@ tag import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%@ tag import="com.probiz.estore.catalog.service.ProductCategoryManager" %>
<%@ tag import="com.probiz.estore.common.model.catalog.ProductCategory" %>

<%@ attribute name="categoryId" type="java.lang.Integer" required="false" description="目录id"%>.
<%@ attribute name="categoryCode" type="java.lang.String" required="false" description="目录Code"%>

<%
	if(null != categoryId || null != categoryCode){
		ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(session.getServletContext());
		ProductCategoryManager productCategoryManager = (ProductCategoryManager) ctx.getBean("productCategoryManager");
		String uri = null;
		if(null!=categoryId){
			 uri = productCategoryManager.getUriByCategoryId(categoryId);
		}else{
			 ProductCategory productCategory = productCategoryManager.getCategoryByCode(categoryCode);
			 uri = productCategoryManager.getUriByCategoryId(productCategory.getCategoryId());
		}
		out.print(application.getAttribute("ctxPath")+uri);
	}
	
%>

